﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace xiaoxiong.KYJControllersLib
{
    public partial class KYJ : UserControl
    {
        public KYJ()
        {
            InitializeComponent();

            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.DoubleBuffer, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.Selectable, true);
            this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
        }



        private int kyjState = 0;

        [Browsable(true)]
        [Category("自定义属性")]
        [Description("空压机状态：0 停止;1 运行;2 故障;其他：备用")]
        public int KYJState
        {
            get { return kyjState; }
            set
            {
                kyjState = value;
                switch (kyjState)
                {
                    case 0:
                        this.BackgroundImage = Properties.Resources.KYJStop;
                        break;
                    case 1:
                        this.BackgroundImage = Properties.Resources.KYJRun;
                        break;
                    case 2:
                        this.BackgroundImage = Properties.Resources.KYJFault;
                        break;
                    default:
                        this.BackgroundImage = Properties.Resources.KYJSpare;
                        break;
                }
            }
        }


        [Browsable(true)]
        [Category("自定义属性")]
        [Description("绑定变量的名称")]
        public string BindVarName { get; set; }
    }
}
